<?php

require_once 'db.class.php';

class Cmt extends Db
{
	public $tbname = 'comment';

	public function clist($id)
	{
		$l = $this->_select(array('id as cmtid','uid','uname','face','address','content as cmt','addtime as pubtime'),array('status'=>1,'tid'=>$id,'DESC'=>'addtime'));
		if($l):
			foreach($l as &$val)
			{
				$an = $this->_select(array('uid','uname','address','content as cmt','addtime as pubtime'),array('status'=>1,'tid'=>0,'cid'=>$val['cmtid'],'DESC'=>'addtime'));
				$val['answer'] = $an ? $an : '';
			}
		endif;
		return $l;
	}
}

?>